﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Models
{
    public class BrandCollection
    {
        #region Fields

        private readonly List<Brand> _brands;

        #endregion

        #region Creation

        public BrandCollection(List<Brand> inputBrand)
        {
            _brands = inputBrand;
        }

        #endregion

        #region Public Methods

        public List<Brand> GetBrands()
        {
            return _brands;
        }

        public List<string> GetNames()
        {
            return _brands.Select((t, i) => _brands.ElementAt(i).Name).ToList();
        }

        public string GetNameAt(int id)
        {
            if (id >= 0 && id < _brands.Count)
            {
                return _brands.ElementAt(id).Name;
            }
            else
            {
                return "";
            }
        }

        #endregion
    }
}
